//
//  AppDelegate.m
//  PeekAndPop
//
//  Created by midea on 16/2/17.
//  Copyright © 2016年 Vincent. All rights reserved.
//

#import "AppDelegate.h"
#import "DetailViewController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    UIApplicationShortcutIcon *icon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeHome];
    NSDictionary *info1 = @{@"url":@"1"};
    
    UIApplicationShortcutItem *item = [[UIApplicationShortcutItem alloc] initWithType:@"itemType" localizedTitle:@"shortcutItem" localizedSubtitle:nil icon:icon userInfo:info1];
    
    [UIApplication sharedApplication].shortcutItems = @[item];
    
    return YES;
}

- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
    
    if ([shortcutItem.type isEqualToString:@"itemType"]) {
        UIViewController *root = [[[UIApplication sharedApplication] keyWindow] rootViewController];
        DetailViewController *helloVc = [[DetailViewController alloc] init];
        [root presentViewController:helloVc animated:TRUE completion:nil];
    }
}

@end
